<template>
  <t-card class="step">
    <t-steps :defaultCurrent="Current">
      <t-step-item title="申请提交" content="提示文字" />
      <t-step-item title="电子发票" content="预计1~3工作日" />
      <t-step-item title="发票已邮寄" content="电子发票开出后7个工作日内联系" />
      <t-step-item title="完成" />
    </t-steps>

    <t-form class="form" :rule="rules" v-if="Current === 0">
      <t-form-item label="合同名称:" name="name">
        <t-select :style="{ width: '322px' }">
          <t-option
            v-for="(item, index) in optionsName"
            :key="index"
            :label="item.label"
            :value="item.value"
          ></t-option>
        </t-select>
      </t-form-item>
      <t-form-item label="发票类型:" name="name1">
        <t-select :style="{ width: '322px' }">
          <t-option
            v-for="(item, index) in optionsType"
            :key="index"
            :label="item.label"
            :value="item.value"
          ></t-option>
        </t-select>
      </t-form-item>
      <t-form-item label="开票金额:">{{ acount }} 元</t-form-item>
      <t-form-item>
        <t-button @click="onSubmit">提交申请</t-button>
      </t-form-item>
    </t-form>

    <t-form class="form" v-if="Current === 1">
      <t-form-item label="发票抬头">
        <t-input
          placeholder="请输入发票抬头"
          :style="{ width: '322px' }"
        ></t-input>
      </t-form-item>
      <t-form-item label="纳税人识别号">
        <t-input
          placeholder="请输入纳税人识别号"
          :style="{ width: '322px' }"
        ></t-input>
      </t-form-item>
      <t-form-item label="单位地址">
        <t-input
          placeholder="请输入单位地址"
          :style="{ width: '322px' }"
        ></t-input>
      </t-form-item>
      <t-form-item label="开户行">
        <t-input
          placeholder="请输入开户行"
          :style="{ width: '322px' }"
        ></t-input>
      </t-form-item>
      <t-form-item label="银行账号">
        <t-input
          placeholder="请输入银行账号"
          :style="{ width: '322px' }"
        ></t-input>
      </t-form-item>
      <t-form-item label="通知邮箱">
        <t-input
          placeholder="请输入通知邮箱"
          :style="{ width: '322px' }"
        ></t-input>
      </t-form-item>
      <t-form-item label="通知手机">
        <t-input
          placeholder="请输入通知手机"
          :style="{ width: '322px' }"
        ></t-input>
      </t-form-item>
      <t-form-item>
        <t-button theme="default" @click="Current = --Current">上一步</t-button>
        <t-button @click="Current = ++Current">下一步</t-button>
      </t-form-item>
    </t-form>

    <t-form class="form" v-if="Current === 2">
      <t-form-item label="收货人">
        <t-input
          placeholder="请填写收货人"
          :style="{ width: '322px' }"
        ></t-input>
      </t-form-item>
      <t-form-item label="手机号码">
        <t-input
          placeholder="请填写手机号码"
          :style="{ width: '322px' }"
        ></t-input>
      </t-form-item>
      <t-form-item label="收货地址">
        <t-input
          placeholder="请填写收货地址"
          :style="{ width: '322px' }"
        ></t-input>
      </t-form-item>
      <t-form-item label="详细地址">
        <t-textarea :style="{ width: '322px' }"></t-textarea>
      </t-form-item>
      <t-form-item>
        <t-button theme="default" @click="Current = --Current">上一步</t-button>
        <t-button @click="Current = ++Current">下一步</t-button>
      </t-form-item>
    </t-form>

    <div class="step-form-4 form" v-if="Current === 3">
      <icon name="check-circle-filled" style="color: green" size="50px" />
      <p class="title item">完成开票申请</p>
      <p class="item">
        预计1～3个工作日会将电子发票发至邮箱，发票邮寄请耐心等待
      </p>
      <div class="item">
        <t-button @click="Current = 0">重新提交</t-button>
        <t-button theme="default">查看进度</t-button>
      </div>
    </div>
  </t-card>
</template>

<script>
import { Icon } from "tdesign-icons-vue";
export default {
  components: {
    Icon,
  },
  data() {
    return {
      Current: 0,
      acount: 288831,
      optionsName: [
        {
          label: "合同A",
          value: "合同A",
        },
        {
          label: "合同B",
          value: "合同B",
        },
        {
          label: "合同C",
          value: "合同C",
        },
      ],
      optionsType: [
        {
          label: "类型A",
          value: "类型A",
        },
        {
          label: "类型B",
          value: "类型B",
        },
        {
          label: "类型C",
          value: "类型C",
        },
      ],
      rules: {
        name: [{ required: true, message: "请选择内容" }],
        name1: [{ required: true, message: "请选择内容" }],
      },
    };
  },
  methods: {
    onSubmit() {
      this.Current = ++this.Current;
      this.$message.success("提交成功");
    },
  },
};
</script>

<style lang="less" scoped>
.form {
  margin-top: 50px;
}
.step-form-4 {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  .title {
    font-weight: 900;
    font-size: 20px;
  }
  .item {
    margin-top: 20px;
  }
}
</style>
